﻿// Designed by Gary,Zhang 2024/11/14
import request from '/@/utils/request';
enum Api {
	GetJobStkInfos = '/api/oracleQuery/getJobStackupInfos',
	GetDataTable = '/api/oracleQuery/dataTable',
	ExecuteCommand = '/api/oracleQuery/executeCommand',
	GetList = '/api/oracleQuery/dynamicList',
}

// 获取叠构审核数据
export const getStkInfos = async (jobName: string) => {
	try {
		const response = await request({
			url: Api.GetJobStkInfos, // 将 jobName 作为路径的一部分
			method: 'get',
			params: { jobName },
		});
		console.log('API Response:', response); // 添加日志
		return response;
	} catch (error) {
		console.error('API Error:', error); // 添加错误日志
		throw error;
	}
};

// 获取DataTable,根据sql查询数据库数据
export const getDataTable = (params?: any) =>
	request({
		url: Api.GetDataTable,
		method: 'get',
		params: params,
	});

// 执行SQL命令
export const executeSqlCommand = (params?: any) =>
	request({
		url: Api.ExecuteCommand,
		method: 'post',
		data: params,
	});

// 获取动态列表
export const getDynamicList = (params?: any) =>
	request({
		url: Api.GetList,
		method: 'get',
		params: params,
	});
